﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.FieldUrl", ServerTypeId="{b1ae9217-e0b0-4e34-9604-bd2462647ee9}")]
    public class FieldUrl : Field
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public FieldUrl(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            string str;
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag && (((str = peekedName) != null) && (str == "DisplayFormat")))
            {
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["DisplayFormat"] = reader.ReadEnum<UrlFieldFormatType>();
            }
            return flag;
        }

        [Remote]
        public UrlFieldFormatType DisplayFormat
        {
            get
            {
                base.CheckUninitializedProperty("DisplayFormat");
                return (UrlFieldFormatType) base.ObjectData.Properties["DisplayFormat"];
            }
            set
            {
                base.ObjectData.Properties["DisplayFormat"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "DisplayFormat", value));
                }
            }
        }
    }
}

